home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1999 #1 / Amiga Plus 1999 #1.iso / System-Boost / Workbench / MRQ / Install < prev    next >
Text File  |  1998-08-10  |  6KB  |  200 lines

  1. ;***********************************************************
  2. ;* Installation script for MRQ, the MUI requester improver *
  3. ;* $VER: MRQ_Install 1.0 (15-Feb-98)                       *
  4. ;* © 1998 Matthias Bethke                                  *
  5. ;*                                                         *
  6. ;* ToDo: let user configure MRQ from within installer      *
  7. ;***********************************************************
  8.  
  9. (procedure expertmsg msg
  10.     (if (> @user-level 1) (message (cat "\n\n" msg)))
  11. )
  12.  
  13. (procedure F_GetDir _prompt _help _default
  14.     (set #Where
  15.         (askdir
  16.             (prompt _prompt)
  17.             (help _help)
  18.             (default _default)
  19.         )
  20.     )
  21. )
  22.  
  23. (procedure F_findconfig
  24.     (set #Configfile "")
  25.     (iconinfo (dest #Installname) (gettooltype "CONFIGFILE" "#Configfile"))
  26.     (if    (not (strlen #Configfile))
  27.         (
  28.         (F_GetDir #P_WConfig #H_WConfig #WhereMRQ)
  29.         (set #Configfile (tackon #Where "MRQ.config"))
  30.         )
  31.     )
  32. )
  33.  
  34. (procedure F_findimages
  35.     (set #WhereImages "")
  36.     (iconinfo (dest #Installname) (gettooltype "IMAGES" "#WhereImages"))
  37.     (if    (not (strlen #WhereImages))
  38.         (
  39.         (F_GetDir #P_WImages #H_WImages #WhereMRQ)
  40.         (set #WhereImages (tackon #Where "MRQ-images"))
  41.         )
  42.     )
  43. )
  44.  
  45. (procedure F_copyconfig
  46.     (expertmsg (cat #M_CopyingConfig #Configfile))
  47.     (copyfiles
  48.         (source #cfgsrc)
  49.         (dest (pathonly #Configfile))
  50.         (newname "MRQ.config")
  51.         (optional askuser)
  52.     )
  53. )
  54.  
  55. (procedure F_copymrq icon
  56.     (if icon
  57.         (
  58.             (expertmsg (cat #M_CopyingMRQ #M_CopyingMRQIcon #M_To #WhereMRQ))
  59.             (copyfiles (source "MRQ") (infos) (dest #WhereMRQ) (optional askuser))
  60.         )
  61.         (
  62.             (expertmsg (cat #M_CopyingMRQ #M_To #WhereMRQ #M_KeepingMRQIcon))
  63.             (copyfiles (source "MRQ") (dest #WhereMRQ) (optional askuser))
  64.         )
  65.     )
  66. )
  67.  
  68.  
  69.  
  70. ;************** START **************
  71. (if (< @installer-version 2752524) (abort "This script requires Installer V42.12 or greater!"))
  72.  
  73. ; !4 NOVICEs
  74. (if (= @user-level 0) (set @user-level 1))
  75.  
  76. ;no english-only config available yet
  77. (if (= @language "english") (set #cfgsrc "MRQ.config") (set #cfgsrc "MRQ.config"))
  78.  
  79. ;************** initialize variables **************
  80. (set #M_Welcome "\n\nWelcome to\n\nMRQ\n\nThe MUI requester improver")
  81. (set #E_Need020 "MRQ requires at least a 68020 CPU!")
  82. (set #P_WInstall "Where do you want MRQ to be installed?")
  83. (set #H_WInstall "The MRQ executable will be copied to this directory. If you want MRQ to start automatically on bootup, just accept the default.")
  84. (set #P_WImages "Where do you want the images to be copied?\n(a directory will be created)")
  85. (set #H_WImages "The installer will create a directory called\n\"MRQ-Images\"\ninside the directory you select and copy all images there")
  86. (set #P_WConfig "Where do you want to keep the config file?\n")
  87. (set #H_WConfig "A small file called \"MRQ.config\" will be copied to this directory")
  88. (set #M_NoInstalledVer "There is no previously installed version")
  89. (set #M_CopyingConfig "Copying config file as ")
  90. (set #M_CopyingMRQ "Copying MRQ ")
  91. (set #M_To "to ")
  92. (set #M_CopyingMRQIcon "and its icon ")
  93. (set #M_KeepingMRQIcon "\n(old icon will not be overwritten)")
  94. (set #M_VersionToInstall "\n\nVersion to install: V")
  95. (set #M_InstalledVersion "Already installed version: V")
  96. (set #M_CfgExists1 "\n\nConfig file ")
  97. (set #M_CfgExists2 " already exists - not overwritten")
  98. (set #C_CheckNewImgs1 "Copy new images")
  99. (set #C_CheckNewImgs2 "Don't copy anything")
  100. (set #P_CheckImageDir "\n\nShould the distribution be checked for any new images that are not yet installed in ")
  101. (set #H_CheckImageDir (cat
  102. "If you select \"Copy new images\", installer will check for files in the distribution's MRQ-images "
  103. "directory that you don't have in your image directory yet and copy them if it finds any.\n\n\"Don't "
  104. "copy anything\" leaves your image directory as it is."
  105. ))
  106. (set #M_CopyingAllImages "Copying all images to ")
  107. (set #M_Copying1Img "Copying image: ")
  108. (set #M_ImgDirUp2D "Image directory is up to date!")
  109.  
  110.  
  111. ;************** work starts **************
  112. (message #M_Welcome)
  113. (welcome)
  114.  
  115. (set #CPU (database "cpu"))
  116. (if (< #CPU 68020) (abort #E_Need020))
  117.  
  118. (F_GetDir #P_WInstall #H_WInstall "SYS:wbstartup")
  119. (set #WhereMRQ #Where)
  120.  
  121. (set @default-dest #WhereMRQ)
  122. (set #Installname (tackon #WhereMRQ "MRQ"))
  123.  
  124. (set #Oldversion (getversion #Installname))
  125. (set #MRQVersion (getversion "MRQ"))
  126. (set #OldVer (/ #Oldversion 65536))
  127. (set #OldRev (- #Oldversion (* #OldVer 65536)))
  128. (set #MRQVer (/ #MRQVersion 65536))
  129. (set #MRQRev (- #MRQVersion (* #MRQVer 65536)))
  130. (set #OldExists (or #OldVer #OldRev))
  131.  
  132. (message (cat
  133.     (cat #M_VersionToInstall #MRQVer "." #MRQRev "\n\n")
  134.     (if #OldExists
  135.         (cat #M_InstalledVersion #OldVer "." #OldRev)
  136.         (#M_NoInstalledVer)
  137.     ))
  138. )
  139.  
  140. (F_findconfig)
  141. (F_findimages)
  142.  
  143. (if (not #OldExists)
  144.     (
  145.     (tooltype (dest "MRQ") (settooltype "CONFIGFILE" #Configfile))
  146.     (tooltype (dest "MRQ") (settooltype "IMAGES" #WhereImages))
  147.     (if (getversion "cybergraphics.library" (resident))
  148.         (
  149.         (tooltype (dest "MRQ") (settooltype "OK-IMG" (tackon #WhereImages "MRQ_OK.brush")))
  150.         (tooltype (dest "MRQ") (settooltype "CANCEL-IMG" (tackon #WhereImages "MRQ_Cancel.brush")))
  151.         )
  152.     )
  153.     (F_copymrq 1)
  154.     )
  155.     (F_copymrq 0)
  156. )
  157.  
  158.  
  159. (complete 30)
  160.  
  161. (if (not (exists #Configfile))
  162.     (F_copyconfig)
  163.     (message (cat  #M_CfgExists1 #Configfile #M_CfgExists2))
  164. )
  165.  
  166. (complete 60)
  167.  
  168. (if (exists #WhereImages)
  169.     (
  170.         (if
  171.             (askbool
  172.                 (prompt (cat #P_CheckImageDir #WhereImages " ?"))
  173.                 (help #H_CheckImageDir)
  174.                 (choices #C_CheckNewImgs1    #C_CheckNewImgs2)
  175.             )
  176.             (
  177.                 (foreach "MRQ-images" "#?"
  178.                     (
  179.                         (if    (not (exists (tackon #WhereImages @each-name)))
  180.                             (
  181.                                 (expertmsg (cat #M_Copying1Img @each-name))
  182.                                 (copyfiles (source (tackon "MRQ-images" @each-name)) (dest #WhereImages) (optional askuser))
  183.                             ) 
  184.                         )
  185.                     )
  186.                 )
  187.                 (expertmsg #M_ImgDirUp2D)
  188.             )
  189.         )
  190.     )
  191.     (
  192.         (expertmsg (cat #M_CopyingAllImages #WhereImages))
  193.         (foreach "MRQ-images" "#?"
  194.             (copyfiles (source (tackon "MRQ-images" @each-name)) (dest #WhereImages) (optional askuser))
  195.         )
  196.     )
  197. )
  198.  
  199. (complete 100)
  200.